# !/usr/bin/python
# -*-coding:utf-8 -*-
"""
@File    :   yml.py
@Create  :   2021/9/27 14:57
@Author  :   David
"""
import yaml


def get_yml_data(yml_file):
    """
    获取yml文件中指定key的值
    :param yml_file: yml文件
    :return:
    """
    with open(yml_file, 'r', encoding="utf-8") as f:
        data = yaml.load(f, Loader=yaml.FullLoader)
    return data


def get_all_yml_data(yml_file):
    """
    获取yml文件中的所有数据
    :param yml_file: yml文件路径
    :return: 返回generator
    """
    with open(yml_file, 'r', encoding="utf-8") as f:
        data = yaml.load_all(f, Loader=yaml.FullLoader)
    return data
